package com.zys.exercise;

import java.util.Scanner;

public class text {
    public static void main(String[] args) {
        String name = "张三";
        String password = "123456";
        Scanner sc = new Scanner(System.in);
        String username = new String();
        String userpassword = new String();
        int i = 0;
        for (i = 0; i < 3; i++) {
            System.out.println("请输入用户名");
            username = sc.next();
            System.out.println("请输入密码");
            userpassword = sc.next();
            if (username.equals(name) && userpassword.equals(password)) {
                System.out.println("登录成功");
                break;
            }
            if (i < 2) {
                System.out.println("请重新输入");
            }


        }
        if (i == 3) {
            System.out.println("登录失败");
        }
    }
}
